/*
 * @Description: 页面内容包裹组件
 * @Author: Rfan
 * @Date: 2022-09-19 14:08:51
 * @LastEditTime: 2022-09-19 17:48:18
 */

import { Button, Typography } from 'antd';
import classNames from 'classnames/bind';
import { useOnlinePreviewContext } from '@/view/management/OnlinePreview/contexts/OnlinePreviewContext';
import { PAGE_TYPE_RESULT, PAGE_TYPE_UPLOAD } from '@/view/management/OnlinePreview/constants';
import PageContent from './PageContent';
import styles from '../styles/pageWrap.module.scss';

const cx = classNames.bind(styles);

const PageWrap = () => {
  const { currentPage, setCurrentPage } = useOnlinePreviewContext();

  return (
    <div className={`pane-container ${cx('page-wrap')}`}>
      <div className={cx('preview-title')}>
        <Typography.Title level={5}>EEP预览工具</Typography.Title>
        {currentPage === PAGE_TYPE_RESULT && (
          <Button
            type="primary"
            onClick={() => {
              setCurrentPage(PAGE_TYPE_UPLOAD);
            }}
          >
            重新上传
          </Button>
        )}
      </div>
      <PageContent className={cx('page-content')} />
    </div>
  );
};

export default PageWrap;
